<style type="text/css">
    .form-action-point{
        float: left;
        width:45%;
        border-right:1px dotted #bfbfbf;
        margin-left:10px;
        min-height: 180px;
    }
</style>

<script type="text/javascript">
    function ReloadData(val,sj_id){
        var domain = $("#domain").val();
        window.location.href= domain + '/subjects/score-subject?sj_id='+sj_id+"&type-point="+val;
    }
</script>

<input type="hidden" id="domain" value="<?php echo DOMAIN_INDEX ?>">

<div id="content">
 	 	
     	<section class="grid_9" id="dashtabs" style="width:98%;min-height:400px;">	
			<div id="contact_form" style="width:100%;overflow: hidden">
                <div class="form-action-point">
                    <p style="font-weight:bold;font-size:15px;" class="title-form">Upload file điểm môn <?php echo $this->name; ?></p>
                    <form method="post" name="contact" action="" enctype="multipart/form-data">
                        <label style="font-size:13px;margin-bottom:5px;" for="subject" class="title-row">Chọn điểm:</label> 
                        <select name="type-point">
                            <option value="1">Điểm giữa kỳ</option>
                            <option value="2">Điểm cuối kỳ</option>
                        </select>
                        <div class="cleaner h10"></div>

                        <label style="font-size:13px;margin-bottom:5px;" for="subject" class="title-row">File đính kèm:</label> <input type="file" name="file" id="subject" class="input_field" />
                        <div class="cleaner h10"></div>

                        <input style="background:#68AAEE;padding:4px;" type="submit" value="Đồng ý" id="submit" name="submit" class="submit_btn float_l" />
                        <input type="hidden" value="<?php echo $this->e_id; ?>" name="e_id" >
                    </form>
                </div>
                <div class="form-action-point">
                    <p style="font-weight:bold;font-size:15px;" class="title-form">Export điểm ra file PDF</p>
                    <form method="post" name="contact" action="<?php echo DOMAIN_INDEX ?>/teacher/export-point-subject-pdf" enctype="multipart/form-data">
                        <label style="font-size:13px;margin-bottom:5px;"  for="subject" class="title-row">Chọn điểm:</label> 
                        <select name="type-point">
                            <option value="1">Điểm giữa kỳ</option>
                            <option value="2">Điểm cuối kỳ</option>
                        </select>
                        <div class="cleaner h10"></div>
                        <input style="background:#68AAEE;padding:4px;" type="submit" value="Đồng ý" id="submit" name="submit" class="submit_btn float_l" />
                        
                        <input type="hidden" value="<?php echo $this->sj_name; ?>" name="name-subject" >
                        <input type="hidden" value="<?php echo $this->sj_id; ?>" name="id-subject" >
                    </form>
                </div>
            </div>
           <div class="cleaner h10"></div>
            <?php
                $info = $this->list_student;
                $pointStudent =  $this->pointStudent;
                $sj_id = $this->sj_id;
             //   Zend_Debug::dump($info);
             //   Zend_Debug::dump($pointStudent);die;

                if(isset($info)){
                    ?>
                <form method="post" action="">
                    <div class="box-header">
                        Chấm điểm môn học <?php echo $this->sj_name; ?>
                        <select name="type-point" onChange='ReloadData(this.value,<?php echo $sj_id ?>)'>
                            <option <?php if($this->type_point == 1) echo "selected='selected'" ?> value="1">Điểm giữa kỳ</option>
                            <option  <?php if($this->type_point == 2) echo "selected='selected'" ?>  value="2">Điểm cuối kỳ</option>
                        </select>
                    </div>
                
                    <div id="dashtabs-pages" class="box-content no-padding" >
                      <table class="table no-border">
                        <thead style="width:100%;">
                          <tr>
                            <td width="5%" align="center">STT</td>
                            <td width="15%" align="center">Tên sinh viên </td>
                            <td width="15%" align="center">SHSV</td>
                            
                            <td width="5%" align="center">Điểm</td>
                            <td width="5%" align="center">Ghi chú</td>
                          </tr>
                        </thead>
                        <tbody>
                            <form method="post" action="">
                            <?php 
                             //    Zend_Debug::dump($info);die;
                                if(isset($info) && count($info)){
                                    $i=0;
                                    foreach ($info as $key => $value) {
                                 //       $search = array_search($value["shsv_sv"],$pointStudent);
                                        $pointTemp = "";
                                        $note = "";
                                        ?>
                                        <tr>
                                            <td align="center"><?php echo ($i+1); ?></td>
                                            <td align="center"><?php echo $value["name_sv"] ?></td>
                                            <td align="center"><?php echo $value["shsv_sv"] ?></td>
                                            <?php
                                                foreach ($pointStudent as $key => $valuePoint) {
                                                    if($valuePoint["id_students"] == $value["id_students"]){
                                                        $pointTemp = $valuePoint["point"];
                                                        $note = $valuePoint["note"];
                                                    }
                                                }
                                            ?>
                                            <td align="center"><input value="<?php echo $pointTemp ?>" width="20" type="text" name="<?php echo "point".$i; ?>"></td>
                                            <td align="center"><input width="20"  type="text" value="<?php echo $note ?>" name="<?php echo "note".$i; ?>"> </td>
                                            <input type="hidden" name="<?php echo "id_sv".$i; ?>" value="<?php echo $value["id_students"] ?>">
                                          </tr>
                                        <?php 
                                        $i++;
                                    }
                                }
                            ?>
                            <input type="hidden" name="max" value="<?php echo $i ?>">
                            </form>
                        </tbody>
                      </table>
                    </div>
                    <input type="submit" style="background:#68AAEE;padding:2px;border:2px solid #ababab; margin:10px;" value="Send" id="submit" name="submit" class="submit_btn float_l" />
                </form>  
                    
                    <?php
                }
            ?>

        </section>
</div>
